<template>
  <div :class="$cn(`hexagon-container`)">
    <div class="hexagon">
      <div :class="$cn(`hexagon-inner`, props.class)">
        <div class="arrow-icon pre">→</div>
        <div class="arrow-icon next">→</div>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
import { ref } from "vue";
const props = defineProps({
  title: {
    type: String,
    default: "",
  },
  class: {
    type: String,
    default: "",
  },
});
</script>
<style lang="scss" scoped>
$width: 50px;

.hexagon-container {
  display: flex;
  margin-top: 20px;
}

.hexagon {
  position: relative;
  width: $width;
  height: $width;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: linear-gradient(135deg, #9c27b0, #ff6090);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: transform 0.3s ease;

  &::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background-color: white;
    z-index: 1;
  }
}

.hexagon-inner {
  position: relative;
  z-index: 2;
  display: flex;
  color: white;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  &:hover {
    .pre {
      transform: translate(0, 0) rotate(-45deg);
    }
    .next {
      transform: translate(calc($width/2), calc(-#{$width}/ 2)) rotate(-45deg);
    }
  }
}

.arrow-icon {
  color: white;
  font-size: 20px;
  transform: rotate(-45deg);
  font-weight: bold;
  position: absolute;
  transition: all 0.5s;
  &.pre {
    transform: translate(calc(-#{$width} / 2), calc((#{$width} / 2))) rotate(-45deg);
  }
}
</style>
